
module debounced_buttons(clk, rst_n, buttons_in, buttons_posedge, buttons_negedge, buttons_out);

    parameter BUTTON_NUM = 3;

    input clk;
    input rst_n;
    input  wire [BUTTON_NUM:1] buttons_in;
    output wire [BUTTON_NUM:1] buttons_posedge;
    output wire [BUTTON_NUM:1] buttons_negedge;
    output wire [BUTTON_NUM:1] buttons_out;

    genvar i;
    generate
        for(i=1;i<=BUTTON_NUM;i=i+1)
        begin: ax_debounce_loop
            ax_debounce u_ax_debounce(
            .clk(clk),
            .rst(~rst_n),
            .button_in(buttons_in[i]),
            .button_posedge(buttons_posedge[i]),
            .button_negedge(buttons_negedge[i]),
            .button_out(buttons_out[i])
            );
        end
    endgenerate

endmodule
